home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / itgraph / delphi / nodeinfo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-09-05  |  3.2 KB  |  102 lines

  1. unit Nodeinfo;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  6.   StdCtrls, ExtCtrls, ITGraph, SysUtils, ITGDefs;
  7.  
  8. type
  9.   TNodeInfoDlg = class(TForm)
  10.     AcceptBtn: TBitBtn;
  11.     CancelBtn: TBitBtn;
  12.     Bevel1: TBevel;
  13.     Label1: TLabel;
  14.     Memo1: TMemo;
  15.     Label2: TLabel;
  16.     Label3: TLabel;
  17.     ItemId: TEdit;
  18.     ItemData: TEdit;
  19.     Label4: TLabel;
  20.     ItemXpos: TEdit;
  21.     Label5: TLabel;
  22.     ItemYpos: TEdit;
  23.     Label6: TLabel;
  24.     ItemWidth: TEdit;
  25.     Label7: TLabel;
  26.     ItemHeight: TEdit;
  27.     ListSources: TListBox;
  28.     LabelSources: TLabel;
  29.     ListTargets: TListBox;
  30.     LabelTargets: TLabel;
  31.     procedure FormShow(Sender: TObject);
  32.     procedure AcceptBtnClick(Sender: TObject);
  33.   private
  34.     { Private declarations }
  35.   public
  36.     { Public declarations }
  37.     itgTheGraph : ^TITGraph;
  38.   end;
  39.  
  40. var
  41.   NodeInfoDlg: TNodeInfoDlg;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. procedure TNodeInfoDlg.FormShow(Sender: TObject);
  48. var
  49.    itemIx : Integer;
  50.    currentIx : Integer;
  51. begin
  52.      itemIx := itgTheGraph^.SelectedIndex;
  53.      NodeInfoDlg.Caption := Concat('Properties for Item ', IntToStr(itemIx + 1),
  54.                             ' of ', IntToStr(itgTheGraph^.ListCount));
  55.      Memo1.Text := itgTheGraph^.List(.itemIx.);
  56.      ItemId.Text := IntToStr(itgTheGraph^.ItemId(.itemIx.));
  57.      ItemData.Text := IntToStr(itgTheGraph^.ItemData(.itemIx.));
  58.      ItemXpos.Text := IntToStr(itgTheGraph^.ItemXpos(.itemIx.));
  59.      ItemYpos.Text := IntToStr(itgTheGraph^.ItemYpos(.itemIx.));
  60.      ItemWidth.Text := IntToStr(itgTheGraph^.ItemWidth(.itemIx.));
  61.      ItemHeight.Text := IntToStr(itgTheGraph^.ItemHeight(.itemIx.));
  62.  
  63.      itgTheGraph^.QueryItem := itemIx;
  64.      itgTheGraph^.QueryState := ITG_QueryGetSources;
  65.      LabelSources.Caption := Concat('Sources: ',
  66.                              IntToStr(itgTheGraph^.QueryCount));
  67.      ListSources.Clear;
  68.      while itgTheGraph^.QueryState <> ITG_QueryNone do
  69.      begin
  70.           currentIx := itgTheGraph^.ConnectFromIndex;
  71.           ListSources.Items.Add(itgTheGraph^.List(.currentIx.));
  72.           itgTheGraph^.QueryState := ITG_QueryIterate
  73.      end;
  74.  
  75.      itgTheGraph^.QueryItem := itemIx;
  76.      itgTheGraph^.QueryState := ITG_QueryGetTargets;
  77.      LabelTargets.Caption := Concat('Targets: ',
  78.                              IntToStr(itgTheGraph^.QueryCount));
  79.      ListTargets.Clear;
  80.      while itgTheGraph^.QueryState <> ITG_QueryNone do
  81.      begin
  82.           currentIx := itgTheGraph^.ConnectToIndex;
  83.           ListTargets.Items.Add(itgTheGraph^.List(.currentIx.));
  84.           itgTheGraph^.QueryState := ITG_QueryIterate
  85.      end;
  86. end;
  87.  
  88. procedure TNodeInfoDlg.AcceptBtnClick(Sender: TObject);
  89. var
  90.    itemIx : Integer;
  91. begin
  92.      itemIx := itgTheGraph^.SelectedIndex;
  93.      itgTheGraph^.List(.itemIx.) := Memo1.Text;
  94.      itgTheGraph^.ItemData(.itemIx.) := StrToInt(ItemData.Text);
  95.      itgTheGraph^.ItemXpos(.itemIx.) := StrToInt(ItemXpos.Text);
  96.      itgTheGraph^.ItemYpos(.itemIx.) := StrToInt(ItemYpos.Text);
  97.      itgTheGraph^.ItemWidth(.itemIx.) := StrToInt(ItemWidth.Text);
  98.      itgTheGraph^.ItemHeight(.itemIx.) := StrToInt(ItemHeight.Text);
  99. end;
  100.  
  101. end.
  102.